package priv.menguer.adapter.service.impl;

import priv.menguer.adapter.service.AdvancedMediaPlayer;
import priv.menguer.adapter.service.MediaPlayer;

/**
 * @Title MediaAdapter.java
 * @description TODO
 * @time 2018年10月26日 上午9:18:34
 * @author menguer@126.com
 * @version 1.0
 */
public class MediaAdapter implements MediaPlayer {

	AdvancedMediaPlayer advancedMusicPlayer;

	public MediaAdapter(String audioType) {
		if (audioType.equalsIgnoreCase("vlc")) {
			advancedMusicPlayer = new VlcPlayer();
		} else if (audioType.equalsIgnoreCase("mp4")) {
			advancedMusicPlayer = new Mp4Player();
		}
	}

	@Override
	public void play(String audioType, String fileName) {
		if (audioType.equalsIgnoreCase("vlc")) {
			advancedMusicPlayer.playVlc(fileName);
		} else if (audioType.equalsIgnoreCase("mp4")) {
			advancedMusicPlayer.playMp4(fileName);
		}
	}
}
